// ! keyof: 约定类型是某个对象or类型的属性名

type Point = { x: number; y: number }

type K = keyof Point

let str: K = 'x'

function getValue(obj: any, key: string) {
	return obj[key]
}

let obj = { a: 1, b: 2, c: 3 }
// type KObj = keyof {a:1,b:2,c:3}
// let k1:KObj = ''

console.log(getValue(obj, 'c'))

// function getProp<Type, Key extends keyof Type>(obj: Type, key: Key) {
//     return obj[key]
// }
// let person = { name: 'jack', age: 18 }
// getProp(person, 'age')
